import request from '@/utils/request'

// 查询生产备料申请列表
export function listPreparation(query) {
  return request({
    url: '/bill/preparation/list',
    method: 'get',
    params: query
  })
}

// 查询生产备料申请详细
export function getPreparation(id) {
  return request({
    url: '/bill/preparation/' + id,
    method: 'get'
  })
}

// 新增生产备料申请
export function addPreparation(data) {
  return request({
    url: '/bill/preparation',
    method: 'post',
    data: data
  })
}

// 修改生产备料申请
export function updatePreparation(data) {
  return request({
    url: '/bill/preparation',
    method: 'put',
    data: data
  })
}

// 删除生产备料申请
export function delPreparation(id) {
  return request({
    url: '/bill/preparation/' + id,
    method: 'delete'
  })
}

// 确定生产备料申请
export function confirmPreparation(data) {
  return request({
    url: '/bill/preparation/confirm/'+data,
    method: 'post'
  })
}

//  获取下发订单信息
export function getDistributeInfo(data) {
  return request({
    url: '/bill/preparation/getDistributeInfo/'+data,
    method: 'get'
  })
}

//  确认下发订单信息
export function confirmDistribute(data) {
  return request({
    url: '/bill/preparation/confirmDistribute',
    method: 'POST',
    data
  })
}

// 重新获取“库存可满足数量”
export function getStockQty(data) {
  return request({
    url: '/bill/preparation/getStockQty/'+data,
    method: 'get'
  })
}


// 查询生产备料申请清单列表
export function listPreparationDetail(query) {
  return request({
    url: '/bill/preparationDetail/list',
    method: 'get',
    params: query
  })
}

// 查询生产备料申请清单详细
export function getPreparationDetail(id) {
  return request({
    url: '/bill/preparationDetail/' + id,
    method: 'get'
  })
}

// 新增生产备料申请清单
export function addPreparationDetail(data) {
  return request({
    url: '/bill/preparationDetail',
    method: 'post',
    data: data
  })
}

// 修改生产备料申请清单
export function updatePreparationDetail(data) {
  return request({
    url: '/bill/preparationDetail',
    method: 'put',
    data: data
  })
}

// 删除生产备料申请清单
export function delPreparationDetail(id) {
  return request({
    url: '/bill/preparationDetail/' + id,
    method: 'delete'
  })
}
